package com.ruoyi.project.rate.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ruoyi.framework.web.service.CrudService;
import com.ruoyi.project.rate.domain.Attach;
import com.ruoyi.project.rate.mapper.AttachMapper;

@Service
public class AttachService extends CrudService<AttachMapper, Attach> {
    @Autowired
    private AttachMapper attachMapper;
    
    @Transactional(readOnly = true)
    public List<Attach> findListByRelId(String relId) {
    	if (StringUtils.isNotBlank(relId)) {
    		Attach attach = new Attach();
        	attach.setRelId(relId);
        	List<Attach> list = this.findList(attach);
        	if (list != null) {
        		return list;
        	}
    	}
    	return new ArrayList<Attach>();
    }
    
    @Transactional(readOnly = false)
    public int deleteByRelIdAndNotIn(Map<String, Object> map) {
    	return this.attachMapper.deleteByRelIdAndNotIn(map);
    }
    
    @Transactional(readOnly = false)
    public int updateRelId(Attach attach) {
    	return this.attachMapper.updateRelId(attach);
    }
}